package com.igame.common;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {
    private Boolean state; //返回状态信息 true为成功
    private String errMessage;

    private T data; //数据

    private String Token;

    public static <T> Result<T> success() {
        Result<T> result = new Result<T>();
        result.state = true;
        return result;
    }

    public static <T> Result<T> success(T object) {
        Result<T> result = new Result<T>();
        result.data = object;
        result.state = true;
        return result;
    }

    public static <T> Result<T> error(String msg) {
        Result result = new Result();
        result.errMessage = msg;
        result.state = false;
        return result;
    }
}
